﻿namespace ACCOUNTING.LVY.Business
{
    using System;
    using System.Collections;

    public class HTDefaultValue : CollectionBase
    {
        public DefaultValue Add(DefaultValue Value)
        {
            this.InnerList.Add(Value);
            return Value;
        }

        public DefaultValue Add(string Ma, string NghiepVu, string Loai, string GiaTri)
        {
            DefaultValue value3 = new DefaultValue {
                Ma = Ma,
                NghiepVu = NghiepVu,
                Loai = Loai,
                GiaTri = GiaTri
            };
            this.InnerList.Add(value3);
            return value3;
        }

        public DefaultValue Item(DefaultValue defval)
        {
            int index = this.InnerList.IndexOf(defval);
            return (DefaultValue) this.InnerList[index];
        }

        public DefaultValue Item(int Index)
        {
            return (DefaultValue) this.InnerList[Index];
        }

        public DefaultValue Item(string Ma)
        {
            IEnumerator enumerator=null;
            DefaultValue current = new DefaultValue();
            try
            {
                enumerator = this.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    current = (DefaultValue) enumerator.Current;
                    if (current.Ma.Trim() == Ma.Trim())
                    {
                        int index = this.InnerList.IndexOf(current);
                        return (DefaultValue) this.InnerList[index];
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            current.GiaTri = "";
            current.Loai = "";
            current.Ma = "";
            current.NghiepVu = "";
            return current;
        }

        public void Remove(DefaultValue defval)
        {
            this.InnerList.Remove(defval);
        }

        public void Remove(int Index)
        {
            DefaultValue value2 = (DefaultValue) this.InnerList[Index];
            if (value2 != null)
            {
                this.InnerList.Remove(value2);
            }
        }
    }
}

